//封装axios，配置请求地址 baseUrl.
import axios from "axios";
const instance = axios.create({
  baseURL: "/api",
});
instance.interceptors.request.use(function (config) {
  let token = localStorage.getItem('token')
  if (token) {
      config.headers['x-authorization'] = token
  }
  return config;
}, function (error) {
  // 对请求错误做些什么
  return Promise.reject(error);
});

export default instance
